package com.mybatis.service.sys.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mybatis.basic.entity.AjaxJson;
import com.mybatis.dao.sys.UserDao;
import com.mybatis.entity.TestUser;
import com.mybatis.service.sys.UserService;

@Service("userService")
public class UserServiceImpl implements UserService{
	
	@Autowired
	private UserDao userDao;

	@Override
	public AjaxJson add(TestUser testUser) {
		AjaxJson ajaxJson = new AjaxJson();
		try {
			userDao.add(testUser);
			ajaxJson.setSuccess(true);
			ajaxJson.setMsg("操作成功");
		} catch (Exception e) {
			e.printStackTrace();
			ajaxJson.setSuccess(false);
			ajaxJson.setMsg("操作失败");
		}
		return ajaxJson;

	}
	
	@Override
	public TestUser select(){
		System.err.println("开始");
		TestUser testUser=userDao.select();
		System.out.println(testUser);
		return testUser;
	}
}
